import request from '@/config/axios'

// 库存记录 VO
export interface InventoryRecordVO {
  id: string // 主键
  cid: string // 商品id
  count: number // 数量
  createAt: string // 创建时间
  description: string // 描述信息
  name: string // 商品名
  type: number // -1出库、1入库
  wid: string // 仓库id
}

// 库存记录 API
export const InventoryRecordApi = {
  // 查询库存记录分页
  getInventoryRecordPage: async (params: any) => {
    return await request.get({ url: `/wms/inventory-record/page`, params })
  },

  // 查询库存记录详情
  getInventoryRecord: async (id: string) => {
    return await request.get({ url: `/wms/inventory-record/get?id=` + id })
  },

  // 新增库存记录
  createInventoryRecord: async (data: InventoryRecordVO) => {
    return await request.post({ url: `/wms/inventory-record/create`, data })
  },

  // 修改库存记录
  updateInventoryRecord: async (data: InventoryRecordVO) => {
    return await request.put({ url: `/wms/inventory-record/update`, data })
  },

  // 删除库存记录
  deleteInventoryRecord: async (id: string) => {
    return await request.delete({ url: `/wms/inventory-record/delete?id=` + id })
  },

  // 导出库存记录 Excel
  exportInventoryRecord: async (params) => {
    return await request.download({ url: `/wms/inventory-record/export-excel`, params })
  },

  // 出入库分析
  analyze: async (type: number) => {
    return await request.get({ url: `/wms/inventory-record/analyze/` + type })
  },
}
